home *** CD-ROM | disk | FTP | other *** search
/ Adventures with Oslo: Tools & Gadgets / Adventures with Oslo - Tools and Gadgets.ISO / pc / program / db / leftwing / 00039.ls < prev    next >
Encoding:
Text File  |  1994-09-23  |  1.4 KB  |  71 lines

  1. on Blink blinkSpeed
  2.   puppetSprite(21, 1)
  3.   repeat with i = 1 to 5
  4.     set the castNum of sprite 21 to the castNum of sprite 21 - 1
  5.     updateStage()
  6.     wait(blinkSpeed)
  7.   end repeat
  8.   wait(blinkSpeed * 3)
  9.   repeat with i = 1 to 5
  10.     set the castNum of sprite 21 to the castNum of sprite 21 + 1
  11.     updateStage()
  12.     wait(blinkSpeed)
  13.   end repeat
  14.   puppetSprite(21, 0)
  15. end
  16.  
  17. on starteye
  18.   global lastBlink, nextBlink
  19.   puppetSprite(11, 1)
  20.   set lastBlink to the ticks
  21.   set nextBlink to 14 + random(286)
  22. end
  23.  
  24. on moveEye
  25.   set x1 to (the mouseH - 291) * 1.0
  26.   set y1 to (the mouseV - 186) * 1.0
  27.   if ((x1 * x1) + (y1 * y1)) <= 729 then
  28.     set x2 to x1
  29.     set y2 to y1
  30.   else
  31.     if y1 = 0 then
  32.       set y2 to 0
  33.       if x1 > 27 then
  34.         set x2 to 27
  35.       else
  36.         if x1 < -27 then
  37.           set x2 to -27
  38.         end if
  39.       end if
  40.     else
  41.       set y2 to sqrt(729 / ((x1 * x1 / (y1 * y1)) + 1))
  42.       if y1 < 0 then
  43.         set y2 to -y2
  44.       end if
  45.       set x2 to x1 * y2 / y1
  46.     end if
  47.   end if
  48.   set the locH of sprite 11 to 291 + x2
  49.   set the locV of sprite 11 to 186 + y2
  50.   randomBlink()
  51. end
  52.  
  53. on randomBlink
  54.   global lastBlink, nextBlink
  55.   if (the ticks - lastBlink) >= nextBlink then
  56.     if (random(2) mod 2) = 0 then
  57.       Blink(0)
  58.     else
  59.       Blink(1)
  60.     end if
  61.     set lastBlink to the ticks
  62.     set nextBlink to 14 + random(226)
  63.   end if
  64. end
  65.  
  66. on wait ticks
  67.   set temp to the ticks
  68.   repeat while (the ticks - temp) < ticks
  69.   end repeat
  70. end
  71.